	// render texture and bloom map
	uniform sampler2D HDRTexture;
	// Control exposure with this value
	float exposure = 10.0;
	// Max bright
	float brightMax = 10.0;

	void main()
	{
		vec2 st = gl_TexCoord[0].st;
		vec4 color = texture2D(HDRTexture, st);

		// Perform tone-mapping
		float Y = dot(vec4(0.30, 0.59, 0.11, 0.0), color);
		float YD = exposure * (exposure/brightMax + 1.0) / (exposure + 1.0);
		color *= YD;
		gl_FragColor = color;
	}